<template>
	<view>
		<view class="content">
			<view class="content-img-box">
				<swiper class="swiper" :indicator-dots="indicatorDots" :circular="true" :autoplay="autoplay" :interval="interval" :duration="duration">
					<swiper-item v-for="(item,index) in data.imgList">
						<image class="img" :src="item" mode="" @click="scaleImg(item,index)"></image>
					</swiper-item>
				</swiper>
			</view>
			<view class="content-des">
				<!-- <view class="">司机：{{data.driver}}</view> -->
				<!-- <view class="">手机号：{{data.phone}}</view> -->
				<view class="">药剂：{{data.drug}}</view>
				<view class="">供应商：{{data.destination}}</view>
				<view class="">皮重时间：{{data.piDatetime}}</view>
				<view class="">毛重时间：{{data.maoDatetime}}</view>
				<!-- <view class="">卸药时间：{{data.endtime}}</view> -->
				<view class="">毛重：{{data.maoNum}}{{data.punit}}</view>
				<view class="">皮重：{{data.piNum}}{{data.punit}}</view>
				<view class="" style="font-weight: bold;">净重：{{data.niNum}}{{data.punit}}</view>
			</view>
		</view>
		<!-- #ifdef APP-PLUS -->
		<!-- <view class="map-box">
			<map class="map" :latitude="latitude" :longitude="longitude" :markers="covers" :polyline="polyline">
			</map>
		</view> -->
		<!-- #endif -->
	</view>
</template>


<script>
	import {formatImgList} from '../../../../common/custom_util.js'
	import _custom from '../../../../common/_custom.js'
	
	export default {
		components:{
			
		},
		data() {
			return {
				latitude: 39.909,
				longitude: 116.39742,
				covers: [{
					latitude: 39.909,
					longitude: 116.39742,
					iconPath: '../../../static/location.png'
				}, {
					latitude: 39.90,
					longitude: 116.39,
					iconPath: '../../../static/location.png'
				}],
				polyline: [
					{
						points: [],
						color: '#5FBD81',
						width: 8
					}
				],
				data: {},
				indicatorDots: true,
				autoplay: true,
				interval: 5000,
				duration: 1000
			}
		},
		onLoad(option) {
			this.data = JSON.parse(option.data)
			console.log(this.data)
			let maoImages = this.data.maoImages ? formatImgList(this.data.maoImages) : []
			let piImages = this.data.piImages ? formatImgList(this.data.piImages) : []
			let unloadImages = this.data.unloadImages ? formatImgList(this.data.unloadImages) : []
			let temp = [];
			maoImages.forEach(item => {
				temp.push(item)
			})
			piImages.forEach(item => {
				temp.push(item)
			})
			unloadImages.forEach(item => {
				temp.push(item)
			})
			this.data.imgList = temp
			// uni.$on('wuni-gps-list',res => {
			// 	let points = [];
			// 	res.forEach(item => {
			// 		points.push({
			// 			latitude: item.bLat, 
			// 			longitude: item.bLng
			// 		})
			// 	})
			// 	this.latitude = points[0].latitude;
			// 	this.longitude = points[0].longitude;
			// 	this.polyline[0].points = points;
			// })
			// this.getWuNiGPSList()
		},
		methods: {
			scaleImg(v,i) {
				uni.previewImage({
					current: i,
					urls: this.data.imgList,
					indicator: 'number'
				})
			},
			getWuNiGPSList() {
				_custom.getDataJava({
					name: 'wuni-gps-list',
					apiname: 'getWuNiGPSList',
					apiparam: {
						pbz: this.data.pbz
					}
				})
			}
		}
	}
</script>

<style>
	.map {
		width: 750rpx;
		height: 50vh;
	}
	
	.content {
		padding: 20rpx;
	}
	
	.swiper {
		height: 400rpx;
	}
	
	.img {
		width: 100%;
		height: 100%;
	}
	
	.content-des {
		padding: 20rpx;
		background-color: #fff;
		border-radius: 10rpx;
		box-shadow: 0 0 10rpx 2rpx rgba(0, 0, 0, .1);
		font-size: 25rpx;
		margin-top: 20rpx;
		margin-bottom: 30rpx;
	}
</style>
